package com.studyinghome;

import com.studyinghome.netty.NettyWebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.task.TaskExecutor;

/**
 * springboot Netty应用程序
 *
 * @author leslie
 * @date 2023/03/08
 */
@SpringBootApplication
public class SpringbootNettyApplication implements CommandLineRunner {
    @Autowired
    private NettyWebSocketServer nettyWebSocketServer;
    @Autowired
    private TaskExecutor dispatchExecutor;

    public static void main(String[] args) {
        SpringApplication.run(SpringbootNettyApplication.class, args);
    }

    @Override
    public void run(String... args) {
        dispatchExecutor.execute(nettyWebSocketServer);
    }
}
